package com.hsh.utils.vo;

import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ResultBase {

    // 代码
    private Integer code;

    // 结果状态
    private boolean success;

    // 结果信息
    private String message;


    private ResultBase(Integer code, boolean success, String message) {
        this.code = code;
        this.success = success;
        this.message = message;
    }

    public static ResultBase getResult(Integer code, boolean success, String message) {
        return new ResultBase(code, success, message);
    }

    public static ResultBase getSuccessResult(String message) {
        return getResult(200, true, message);
    }

    public static ResultBase getSuccessResult() {
        return getResult(200, true, "success");
    }

    public static ResultBase getFailResult(Integer code, String message) {
        return getResult(code, false, message);
    }

    public static ResultBase getFailResult(String message) {
        return getResult(500, false, message);
    }

    public static ResultBase getFailResult() {
        return getResult(500, false, "failure");
    }

}
